package cn.dm.item.client;

import cn.dm.common.Page;
import cn.dm.config.DmConfiguration;
import cn.dm.fallback.DmItemClientFallBack;
import cn.dm.mapper.DmItemMapper;
import cn.dm.pojo.DmItem;
import cn.dm.vo.DmFloorItems;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* Created by shang-pc on 2018/5/15.
*/
@RestController
public class DmItemService {
    @Resource
    private DmItemMapper dmItemMapper;

    @RequestMapping(value = "/getDmItemById",method = RequestMethod.POST)
    public DmItem getDmItemById(@RequestParam("id") Long id)throws Exception{
        return dmItemMapper.getDmItemById(id);
    }

    @RequestMapping(value = "/getDmItemListByMap",method = RequestMethod.POST)
    public List<DmItem>	getDmItemListByMap(@RequestBody Map<String, Object> param)throws Exception{
        return dmItemMapper.getDmItemListByMap(param);
    }

    @RequestMapping(value = "/getHotDmItemList", method = RequestMethod.POST)
    public List<DmItem> getHotDmItemList(@RequestBody Map<String, Object> param) throws Exception{
        return dmItemMapper.getHotDmItemList(param);
    }

    @RequestMapping(value = "/getDmItemCountByMap",method = RequestMethod.POST)
    public Integer getDmItemCountByMap(@RequestBody Map<String, Object> param)throws Exception{
        return dmItemMapper.getDmItemCountByMap(param);
    }

    @RequestMapping(value = "/qdtxAddDmItem",method = RequestMethod.POST)
    public Integer qdtxAddDmItem(@RequestBody DmItem dmItem)throws Exception{
        return dmItemMapper.insertDmItem(dmItem);
    }

    @RequestMapping(value = "/qdtxModifyDmItem",method = RequestMethod.POST)
    public Integer qdtxModifyDmItem(@RequestBody DmItem dmItem)throws Exception{
        return dmItemMapper.updateDmItem(dmItem);
    }

    @RequestMapping(value = "/queryItemByFloor",method = RequestMethod.POST)
    public List<DmFloorItems> queryItemByFloor()throws Exception{
        return dmItemMapper.queryItemByFloor();
    }

    @RequestMapping(value = "/queryItemByMonth",method = RequestMethod.POST)
    public List<DmItem> queryItemByMonth(@RequestParam Map<String, Object> param)throws Exception{
        return dmItemMapper.getItemByMonth(param);
    }

    @RequestMapping(value = "/getDmItemListByMapForEs",method = RequestMethod.POST)
    public List<DmItem> getDmItemListByMapForEs(@RequestParam Map<String, Object> param) throws Exception{
        return dmItemMapper.getHotDmItemListForEs(param);
    }

    @RequestMapping(value = "/queryDmItemPage",method = RequestMethod.POST)
    public Page<DmItem> queryDmItemPage(@RequestParam Map<String, Object> param) throws Exception{
        return null;
    }

}
